package com.codefish.framework.spring.aop.framework.cglib;

import com.codefish.framework.spring.aop.framework.ReflectiveMethodInvocation;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * 实现cglib下的方法调用逻辑
 *
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/10/17 下午 07:31
 */
public class CglibMethodInvocation extends ReflectiveMethodInvocation {
    MethodProxy methodProxy;


    public CglibMethodInvocation(Object target, Method method, Object[] args, MethodProxy methodProxy) {
        super(target, method, args);
        this.methodProxy = methodProxy;
    }

    @Override
    public Object proceed() throws Throwable {
        //真正调用代理类的父类的方法
        return methodProxy.invokeSuper(target, args);
    }
}
